<%@ page import="java.util.List" %>
<%@ page import="com.foreknow.bean.Guestbook" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/12/1
  Time: 10:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
</head>
<body>
    <div class="container">
        用户名：${sessionScope.name}
        <table class="table table-hover">
            <tr>
                <td>id</td>
                <td>name</td>
                <td>phone</td>
                <td>email</td>
                <td>title</td>
                <td>content</td>
                <td>createdtime</td>
                <td>操作</td>
            </tr>
<%--            <%--%>
<%--                // Java代码部分--%>
<%--                // 从request中获取到list集合，然后遍历集合--%>
<%--                List<Object> list = (List<Object>) request.getAttribute("list");--%>
<%--                for (int i = 0;i<list.size();i++) {--%>
<%--                    Guestbook gb = (Guestbook) list.get(i);--%>
<%--            %>--%>
          <%-- items接收一个集合 ${requestScope.list}/${list}   var表示变量的名称--%>
            <c:forEach var="gb" items="${requestScope.list}" varStatus="status">
                <tr>
                    <%--让变量名称从1开始依次递增--%>
                    <td>${status.index+1}</td>
                    <td>${gb.name}</td>
                    <td>${gb.phone}</td>
                    <td>${gb.email}</td>
                    <td>${gb.title}</td>
                    <td>${gb.content}</td>
                    <td>${gb.createdtime}</td>
                    <td>
                        <a href="/qw/manager?q=into" class="btn btn-primary">添加</a>
                        <a href="/qw/manager?q=jump&id=${gb.id}" class="btn btn-warning">修改</a>
                        <a href="/qw/manager?q=delete&id=${gb.id}" class="btn btn-danger">删除</a>
                    </td>
                </tr>
            </c:forEach>
<%--            <%--%>
<%--                }--%>
<%--            %>--%>
        </table>
    </div>
</body>
</html>
